-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: reduce block interval poc #265
base: develop
Are you sure you want to change the base?
Conversation
6f6c827
to
01d6315
Compare
baa5440
to
bf3372a
Compare
7da7fa8
to
bff700d
Compare
bff700d
to
8520a2f
Compare
95b03d8
to
d1eb66f
Compare
3c284e5
to
a717b8c
Compare
op-service/eth/heads.go
Outdated
@@ -43,11 +45,18 @@ func WatchHeadChanges(ctx context.Context, src NewHeadSource, fn HeadSignalFn) ( | |||
for { | |||
select { | |||
case header := <-headChanges: | |||
var mTime uint64 | |||
if header.MixDigest == (common.Hash{}) { | |||
mTime = header.Time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is mTime not initialized to 0?
a20bd64
to
618dbe0
Compare
Co-authored-by: 2020xibao <[email protected]>
op-node/rollup/driver/sequencer.go
Outdated
d.CancelBuildingBlock(ctx) | ||
return nil, err | ||
} else if errors.Is(err, derive.ErrTemporary) { | ||
d.log.Error("sequencer failed temporarily to seal new block", "err", err) | ||
d.nextAction = d.timeNow().Add(time.Second) | ||
d.nextAction = d.timeNow().Add(backoffTime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original semantics was to backoff for one second, not necessarily the interval of the block. Why did this change the semantics?
op-node/rollup/driver/sequencer.go
Outdated
// We don't explicitly cancel block building jobs upon temporary errors: we may still finish the block. | ||
// Any unfinished block building work eventually times out, and will be cleaned up that way. | ||
} else { | ||
d.log.Error("sequencer failed to seal block with unclassified error", "err", err) | ||
d.nextAction = d.timeNow().Add(time.Second) | ||
d.nextAction = d.timeNow().Add(backoffTime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
Co-authored-by: 2020xibao <[email protected]>
Co-authored-by: 2020xibao <[email protected]>
@@ -362,11 +362,18 @@ func (s *channelManager) AddL2Block(block *types.Block) error { | |||
} | |||
|
|||
func l2BlockRefFromBlockAndL1Info(block *types.Block, l1info *derive.L1BlockInfo) eth.L2BlockRef { | |||
milliPart := uint64(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L2BlockRef
as the l2BlockRefFromBlockAndL1Info return value, it is only used to mertics, so it is useless for adding the milliPart.
It is most important for op-batcher that adda millsecondes into |
PrevRandao: eth.Bytes32(l1Info.MixDigest()), | ||
SuggestedFeeRecipient: predeploys.SequencerFeeVaultAddr, | ||
Transactions: txs, | ||
NoTxPool: true, | ||
GasLimit: (*eth.Uint64Quantity)(&sysConfig.GasLimit), | ||
Withdrawals: withdrawals, | ||
ParentBeaconBlockRoot: parentBeaconRoot, | ||
}, nil | ||
} | ||
pa.SetMillisecondTimestamp(nextL2MilliTime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SetMillisecondTimestamp(common.hash, millseconds) -> set millseconds to first common.hash.
then the return value to init eth.PayloadAttributes in 173 line, may be better.
@@ -96,7 +96,7 @@ func (bq *BatchQueue) NextBatch(ctx context.Context, parent eth.L2BlockRef) (*Si | |||
if len(bq.nextSpan) > 0 { | |||
// There are cached singular batches derived from the span batch. | |||
// Check if the next cached batch matches the given parent block. | |||
if bq.nextSpan[0].Timestamp == parent.Time+bq.config.BlockTime { | |||
if bq.nextSpan[0].Timestamp == parent.MillisecondTimestamp()+bq.config.MillisecondBlockInterval() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the Timestamp is changed to milliseconds for seconds, add one note that it is active after hard fork, otherwise it is seconds.
Description
Reduce block interval poc.
Notice: This is a draft PR, a work in progress, and not ready for review.
Rationale
TBD
Example
TBD
Changes
Notable changes: